From 5c7979cdf879a6cc9011432098f7ef68ed7f5e37 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Thu, 29 Mar 2018 19:40:02 +0200 Subject: [PATCH] Fix formatting issues with cargo fmt --- src/cargo/core/manifest.rs | 30 +++++++++++------ src/cargo/core/resolver/encode.rs | 3 +- src/cargo/ops/cargo_output_metadata.rs | 3 +- src/cargo/ops/cargo_rustc/fingerprint.rs | 3 +- src/cargo/sources/git/utils.rs | 9 +++-- src/cargo/sources/registry/mod.rs | 3 +- src/cargo/sources/replaced.rs | 7 ++-- src/cargo/util/toml/mod.rs | 42 ++++++++++++++++-------- 8 files changed, 66 insertions(+), 34 deletions(-) diff --git a/src/cargo/core/manifest.rs b/src/cargo/core/manifest.rs index b3ab42659..c004089ed 100644 --- a/src/cargo/core/manifest.rs +++ b/src/cargo/core/manifest.rs @@ -156,20 +156,30 @@ impl ser::Serialize for TargetKind { #[derive(Clone, PartialEq, Eq, Debug, Hash, Serialize)] pub struct Profile { pub opt_level: String, - #[serde(skip_serializing)] pub lto: Lto, - #[serde(skip_serializing)] pub codegen_units: Option, // None = use rustc default - #[serde(skip_serializing)] pub rustc_args: Option>, - #[serde(skip_serializing)] pub rustdoc_args: Option>, + #[serde(skip_serializing)] + pub lto: Lto, + #[serde(skip_serializing)] + pub codegen_units: Option, // None = use rustc default + #[serde(skip_serializing)] + pub rustc_args: Option>, + #[serde(skip_serializing)] + pub rustdoc_args: Option>, pub debuginfo: Option, pub debug_assertions: bool, pub overflow_checks: bool, - #[serde(skip_serializing)] pub rpath: bool, + #[serde(skip_serializing)] + pub rpath: bool, pub test: bool, - #[serde(skip_serializing)] pub doc: bool, - #[serde(skip_serializing)] pub run_custom_build: bool, - #[serde(skip_serializing)] pub check: bool, - #[serde(skip_serializing)] pub panic: Option, - #[serde(skip_serializing)] pub incremental: bool, + #[serde(skip_serializing)] + pub doc: bool, + #[serde(skip_serializing)] + pub run_custom_build: bool, + #[serde(skip_serializing)] + pub check: bool, + #[serde(skip_serializing)] + pub panic: Option, + #[serde(skip_serializing)] + pub incremental: bool, } #[derive(Clone, PartialEq, Eq, Debug, Hash)] diff --git a/src/cargo/core/resolver/encode.rs b/src/cargo/core/resolver/encode.rs index 3bb318c17..8425453d3 100644 --- a/src/cargo/core/resolver/encode.rs +++ b/src/cargo/core/resolver/encode.rs @@ -18,7 +18,8 @@ pub struct EncodableResolve { root: Option, metadata: Option, - #[serde(default, skip_serializing_if = "Patch::is_empty")] patch: Patch, + #[serde(default, skip_serializing_if = "Patch::is_empty")] + patch: Patch, } #[derive(Serialize, Deserialize, Debug, Default)] diff --git a/src/cargo/ops/cargo_output_metadata.rs b/src/cargo/ops/cargo_output_metadata.rs index 96f52d367..681a3090a 100644 --- a/src/cargo/ops/cargo_output_metadata.rs +++ b/src/cargo/ops/cargo_output_metadata.rs @@ -89,7 +89,8 @@ pub struct ExportInfo { /// format for `PackageId`s #[derive(Serialize)] struct MetadataResolve { - #[serde(rename = "nodes", serialize_with = "serialize_resolve")] resolve: Resolve, + #[serde(rename = "nodes", serialize_with = "serialize_resolve")] + resolve: Resolve, root: Option, } diff --git a/src/cargo/ops/cargo_rustc/fingerprint.rs b/src/cargo/ops/cargo_rustc/fingerprint.rs index 7b213bc48..74deda193 100644 --- a/src/cargo/ops/cargo_rustc/fingerprint.rs +++ b/src/cargo/ops/cargo_rustc/fingerprint.rs @@ -152,7 +152,8 @@ pub struct Fingerprint { #[serde(serialize_with = "serialize_deps", deserialize_with = "deserialize_deps")] deps: Vec<(String, Arc)>, local: Vec, - #[serde(skip_serializing, skip_deserializing)] memoized_hash: Mutex>, + #[serde(skip_serializing, skip_deserializing)] + memoized_hash: Mutex>, rustflags: Vec, epoch: Epoch, } diff --git a/src/cargo/sources/git/utils.rs b/src/cargo/sources/git/utils.rs index 2314db18c..5ecb5b1b6 100644 --- a/src/cargo/sources/git/utils.rs +++ b/src/cargo/sources/git/utils.rs @@ -50,7 +50,8 @@ impl GitShortID { /// `GitDatabase`. #[derive(PartialEq, Clone, Debug, Serialize)] pub struct GitRemote { - #[serde(serialize_with = "serialize_str")] url: Url, + #[serde(serialize_with = "serialize_str")] + url: Url, } /// `GitDatabase` is a local clone of a remote repository's database. Multiple @@ -59,7 +60,8 @@ pub struct GitRemote { pub struct GitDatabase { remote: GitRemote, path: PathBuf, - #[serde(skip_serializing)] repo: git2::Repository, + #[serde(skip_serializing)] + repo: git2::Repository, } /// `GitCheckout` is a local checkout of a particular revision. Calling @@ -70,7 +72,8 @@ pub struct GitCheckout<'a> { database: &'a GitDatabase, location: PathBuf, revision: GitRevision, - #[serde(skip_serializing)] repo: git2::Repository, + #[serde(skip_serializing)] + repo: git2::Repository, } // Implementations diff --git a/src/cargo/sources/registry/mod.rs b/src/cargo/sources/registry/mod.rs index 3a8183b28..949c44a22 100644 --- a/src/cargo/sources/registry/mod.rs +++ b/src/cargo/sources/registry/mod.rs @@ -221,7 +221,8 @@ struct RegistryPackage<'a> { features: BTreeMap>, cksum: String, yanked: Option, - #[serde(default)] links: Option, + #[serde(default)] + links: Option, } struct DependencyList { diff --git a/src/cargo/sources/replaced.rs b/src/cargo/sources/replaced.rs index 647df4c23..3f223ef61 100644 --- a/src/cargo/sources/replaced.rs +++ b/src/cargo/sources/replaced.rs @@ -27,9 +27,10 @@ impl<'cfg> Registry for ReplacedSource<'cfg> { let dep = dep.clone().map_source(to_replace, replace_with); self.inner - .query(&dep, &mut |summary| { - f(summary.map_source(replace_with, to_replace)) - }) + .query( + &dep, + &mut |summary| f(summary.map_source(replace_with, to_replace)), + ) .chain_err(|| format!("failed to query replaced source {}", self.to_replace))?; Ok(()) } diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index 092ce8f7f..e0538d221 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -202,7 +202,8 @@ pub struct DetailedTomlDependency { features: Option>, optional: Option, default_features: Option, - #[serde(rename = "default_features")] default_features2: Option, + #[serde(rename = "default_features")] + default_features2: Option, package: Option, } @@ -347,14 +348,18 @@ impl<'de> de::Deserialize<'de> for U32OrBool { #[derive(Deserialize, Serialize, Clone, Debug, Default)] pub struct TomlProfile { - #[serde(rename = "opt-level")] opt_level: Option, + #[serde(rename = "opt-level")] + opt_level: Option, lto: Option, - #[serde(rename = "codegen-units")] codegen_units: Option, + #[serde(rename = "codegen-units")] + codegen_units: Option, debug: Option, - #[serde(rename = "debug-assertions")] debug_assertions: Option, + #[serde(rename = "debug-assertions")] + debug_assertions: Option, rpath: Option, panic: Option, - #[serde(rename = "overflow-checks")] overflow_checks: Option, + #[serde(rename = "overflow-checks")] + overflow_checks: Option, incremental: Option, } @@ -449,9 +454,11 @@ pub struct TomlProject { exclude: Option>, include: Option>, publish: Option, - #[serde(rename = "publish-lockfile")] publish_lockfile: Option, + #[serde(rename = "publish-lockfile")] + publish_lockfile: Option, workspace: Option, - #[serde(rename = "im-a-teapot")] im_a_teapot: Option, + #[serde(rename = "im-a-teapot")] + im_a_teapot: Option, // package metadata description: Option, @@ -461,7 +468,8 @@ pub struct TomlProject { keywords: Option>, categories: Option>, license: Option, - #[serde(rename = "license-file")] license_file: Option, + #[serde(rename = "license-file")] + license_file: Option, repository: Option, metadata: Option, rust: Option, @@ -470,7 +478,8 @@ pub struct TomlProject { #[derive(Debug, Deserialize, Serialize)] pub struct TomlWorkspace { members: Option>, - #[serde(rename = "default-members")] default_members: Option>, + #[serde(rename = "default-members")] + default_members: Option>, exclude: Option>, } @@ -1176,8 +1185,10 @@ struct TomlTarget { // The intention was to only accept `crate-type` here but historical // versions of Cargo also accepted `crate_type`, so look for both. - #[serde(rename = "crate-type")] crate_type: Option>, - #[serde(rename = "crate_type")] crate_type2: Option>, + #[serde(rename = "crate-type")] + crate_type: Option>, + #[serde(rename = "crate_type")] + crate_type2: Option>, path: Option, test: Option, @@ -1185,10 +1196,13 @@ struct TomlTarget { bench: Option, doc: Option, plugin: Option, - #[serde(rename = "proc-macro")] proc_macro: Option, - #[serde(rename = "proc_macro")] proc_macro2: Option, + #[serde(rename = "proc-macro")] + proc_macro: Option, + #[serde(rename = "proc_macro")] + proc_macro2: Option, harness: Option, - #[serde(rename = "required-features")] required_features: Option>, + #[serde(rename = "required-features")] + required_features: Option>, } #[derive(Clone)] -- 2.30.2